import requests

#输入搜索信息
keyword=input('输入搜索信息: ')
#获取链接
url='https://www.sogou.com/web'
#参数
params={
    'query':keyword
}
# 实现ua伪装
headers={
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
}
response=requests.get(url=url,params=params,headers=headers)
response.encoding='utf-8'
with open(f'{keyword}.html','w',encoding='utf-8')  as fs:
    fs.write(response.text)